﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RecipeRecommender
{
   public class Ingredient:IEquatable<Ingredient>
    {
        private String name;
        private int[] value;

       
       public Ingredient(){
           name = "";
           value =  new int[4];
       }

       public Ingredient(String name, int[] value)
       {
           this.name = name;
           this.value = value;
       }
       public Ingredient(String name, int idx0, int idx1, int idx2, int idx3)
       {
           this.name = name;
           this.value = new int[4];
           value[0] = idx0;
           value[1] = idx1;
           value[2] = idx2;
           value[3] = idx3;
       }

       public Ingredient clone()
       {
           Ingredient cIng = new Ingredient();

           cIng.name = name;
           cIng.value = value;
           return cIng;
       }

       public String Name
       {
           get { return name; }
           set { name = value; }
       }

       public int[] Value
       {
           get { return this.value; }
           set { this.value = value; }
       }

       override
       public String ToString()
       {
           StringBuilder printed = new StringBuilder();
           if (Value[1] != 0) printed.Append("  ");
           if (Value[2] != 0) printed.Append("  ");
           if (Value[3] != 0) printed.Append("  ");
           printed.Append(Name);
           return printed.ToString();
       }
       
       public bool Equals(Ingredient other)
       {
           return this.Name.Equals(other.Name);
       }


       public override bool Equals(object obj)
       {
           return Equals(obj as Ingredient);
       }
    }
}
